<!doctype html>
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body>
<select id="popup">
    <optgroup id=optgroup1>
    </optgroup>
</select>
<select id="listbox" multiple>
    <optgroup id=optgroup2>
        <option selected>
    </optgroup>
</select>

<script>
    description("This test ensures that inserting a selected option into an HTML Select element doesn't cause a crash.");

    if (window.testRunner)
        testRunner.dumpAsText();

    var optgroup1 = document.getElementById('optgroup1');
    var optgroup2 = document.getElementById('optgroup2');

    if (window.accessibilityController)
        accessibilityController.accessibleElementById('dummy');

    var listbox = document.getElementById('listbox');
    listbox.focus();

    optgroup1.appendChild(optgroup2);
</script>
</body>
</html>
